/**
 * Copyright (C), 2015-2020, 新华三技术有限公司
 * FileName: OraganizationMapper
 * Author:   c10709
 * Date:     2020/12/2 17:44
 * Description: mapper
 * History:
 * <author>     <time>          <version>    <desc>
 * c10709      2020/12/2 17:44  v1.0        新建类
 */
package com.example.demo.ldap.support;

import com.example.demo.ldap.entity.Organization;
import org.springframework.ldap.core.AttributesMapper;

import javax.naming.NamingException;
import javax.naming.directory.Attributes;

/**
 * 〈一句话功能简述〉<br> 
 * 〈mapper〉
 *
 * @author c10709
 * @create 2020/12/2 17:44
 * @since 1.0.0
 */
public class OraganizationMapper  implements AttributesMapper<Organization> {

    @Override
    public Organization mapFromAttributes(Attributes attrs) throws NamingException {
        Organization org = new Organization();
        org.setOu((String)attrs.get("ou").get());
        org.setOrgName((String)attrs.get("cahOrgName").get());
        org.setSuperDepartment((String)attrs.get("cahSupervisoryDepartment").get());
        org.setTopOrgCode((String)attrs.get("cahTopnodeCode").get());
        org.setDisplayName((String)attrs.get("displayName").get());
        org.setDescription((String)attrs.get("description").get());
        return org;
    }
}